package com.smartum.mpr.json.serializers;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

import com.smartum.mpr.model.County;

public class CountySerializer extends JsonSerializer<County> {

	@Override
	public void serialize(County value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
	        JsonProcessingException {

		jgen.writeStartObject();
		jgen.writeStringField("county", value.getCounty());
		jgen.writeStringField("state", value.getState().getStateName());
		jgen.writeStringField("state_code", value.getState().getStateCode());
		jgen.writeEndObject();

	}

}
